<template>
	
	<view   :style="{ 'padding-top': top + 'px','background-image': 'url('+style['user_center_nav_background']+')' }">
	<view  class="contain padding-12">
		<rich-text :nodes="info.detail | html"></rich-text>
	</view>
	</view>
	
</template>
<style scoped>
</style>
<script>
	const $ = require('@/utils/api.js');
	export default {
		data() {
			return {
					top: uni.getStorageSync('bartop') ? uni.getStorageSync('bartop') : 0,
					type: '',
					info: '',
					defaultImg: '',
					style: '',
			};
		},
		onLoad: function(options) {
			this.type = options.type ? options.type : '';
			
	
			let config = uni.getStorageSync('config') ? uni.getStorageSync('config') : '';
			this.defaultImg = config != '' ? config.default_head_img : '';
			this.getStyle().then((res) => {
				this.style= res;
			})
			
			this.init();
			
			// // 兼容H5下排序栏位置
			// // #ifdef H5
			// // 定时器方式循环获取高度为止，这么写的原因是onLoad中head未必已经渲染出来。
			// let Timer = setInterval(() => {
			// 	let uniHead = document.getElementsByTagName('uni-page-head');
			// 	if (uniHead.length > 0) {
			// 		this.headerTop = uniHead[0].offsetHeight + 'px';
			// 		clearInterval(Timer); // 清除定时器
			// 	}
			// }, 1);
			// // #endif
		},
		methods: {
			getInfo() {			const self = this;
	
				$.ajax({
					url: 'common/agreement/get',
					data: {cate: this.type},
					method: 'GET',
					success(res) {
						self.info = res.data ? res.data : '';
						uni.setNavigationBarTitle({
							title: res.data.title
						})
					}
				})
			},
			init() {
				this.getInfo();
			},
		},
		created() {
		},
		mounted() {},
		destroyed() {},
		components: {},
		onPullDownRefresh() {
		},
		onReachBottom() {
		}
	}
</script>